<template>
  <div>
    <el-card class="header-card">
      <div class="item">
        <p class="font-bold">{{$t('table.贴标单号')}}：{{ data.labelNo }}</p>
        <p class="font-bold" v-if="data.shipment">{{ $t('table.shipmentNumber') }}：{{ data.shipment.shipmentNo }}</p>
        <p class="font-bold" v-if="data.middle">{{ $t('table.送仓单号') }}：{{ data.middle.workNo }}</p>
        <p class="font-bold" v-if="data.transfer">{{ $t('table.调货单号') }}：{{ data.transfer.workNo }}</p>
        <p class="font-bold">{{$t('table.贴标类型')}}：{{ getLabelTypeStr(data.type) }}</p>
        <p class="font-bold">{{$t('table.贴标状态')}}：{{ getLabelStatusStr(data.status) }}</p>
        <p>
          {{$t('table.createTime2')}}：{{ data.createTime }}
          <span class="mgl20" v-if="data.status === 2">{{$t('table.完成时间')}}：{{ data.finishTime}}</span>
        </p>
        <p v-if="data.status === 1">
          {{$t('table.预计贴标SKU种数')}}: {{ data.exSkuNum }}
          <span class="mgl20">{{$t('table.预计贴标商品总数量')}}：{{ data.exGoodsNum }}</span>
        </p>
        <p v-if="data.status === 2">
          {{$t('table.实际贴标SKU种数')}}: {{ data.rlSkuNum }}
          <span class="mgl20">{{$t('table.实际贴标商品总数量')}}：{{ data.rlGoodsNum }}</span>
        </p>
        <p>
          {{ $t('table.贴SKU标单价（元）') }}: {{ data.labelFee }}
          <span class="mgl20" v-if="data.status === 1">{{$t('table.预计贴SKU标费用（元）')}}：{{ data.exTotalFee }}</span>
          <span class="mgl20" v-if="data.status === 2">{{$t('table.实际贴SKU标费用（元）')}}：{{ data.rlTotalFee }}</span>
        </p>
      </div>
      <div class="button">
        <div v-if="data.shipment">
          <el-button type="primary" @click="jumpShipmentInfo(data.shipment.id, true)">{{$t('shipment.货件单')}}</el-button>
        </div>
        <div v-if="data.middle">
          <el-button type="primary" @click="jumpMiddleInfo(data.middle.id, true)">{{$t('middle.送仓工单')}}</el-button>
        </div>
        <div v-if="data.transfer">
          <el-button type="primary" @click="jumpTransferInfo(data.transfer.id, true)">{{$t('transfer.调货工单')}}</el-button>
        </div>
      </div>
    </el-card>

    <div>
      <h4>{{$t('labelOrder.贴标商品详细情况')}}：</h4>

      <template v-if="data.type === 1">
        <div class="mgb10" v-if="containerList.length > 1 && data.status === 1">
          筛选货柜贴标：
          <el-select v-model="containerId">
            <el-option value="" label="全部"></el-option>
            <el-option
              v-for="item in containerList"
              :key="item.id"
              :value="item.id"
              :label="item.containerNo || item.flightNo || '-'"
            >
              {{item.containerNo || item.flightNo || '-'}}
            </el-option>
          </el-select>
        </div>

        <label-order-info-table1 :data="data" :table-data="filterGoodsData"></label-order-info-table1>
      </template>

      <template v-if="data.type === 2">
        <el-table
          :data="goodsData"
          :border="true"
          :span-method="objectSpanMethod3"
        >
          <el-table-column
            prop="image"
            :label="$t('table.productCover')"
            align="center"
            width="120"
          >
            <template slot-scope="{row}">
              <div class="img-box img-one">
                <img :src="row.image" alt="">
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="title"
            :label="$t('table.title')"
            align="left"
            show-overflow-tooltip
            min-width="250"
          >
            <template slot-scope="{row}">
              <div>
                <div class="goods-title hidden-1">{{row.title}}</div>
                <div class="goods-attr hidden-1">
                  <span
                    v-for="attr in row.attributes"
                    :key="attr.name"
                    class="attr"
                  >
                    {{attr.name}} : {{attr.value}}
                    <span class="attr-link"> | </span>
                  </span>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column
            :label="$t('table.本次贴标的Listing ID与SKU')"
            align="center"
            min-width="150"
            prop="toGoodsId"
          >
            <template v-slot="{row}">
              {{row.toGoodsId}} {{row.toSku ? `(${row.toSku})` : ''}}
            </template>
          </el-table-column>
          <m-l-code-column label="新产品标" prop="toInventoryId"></m-l-code-column>
          <el-table-column
            label="旧产品标"
            align="center"
            min-width="150"
            prop="fromGoodsId"
          >
            <template v-slot="{row}">
              <template v-if="row.fromGoodsIsTB">
                {{$t('shipment.Not labeled')}}
              </template>
              <template v-else-if="row.fromGoodsIsSystem">
                <!-- {{$t('shipment.System label')}} -->
                 {{row.fromSku}}
              </template>
              <template v-else>
                {{row.fromGoodsId}} {{row.fromSku ? `(${row.fromSku})` : ''}}
              </template>
            </template>
          </el-table-column>


         <el-table-column
            label="箱数"
            align="center"
            width="150"
            prop="exOneStock"
          >
            <template v-slot="{row}">
              <template v-if="row.stockBoxInfo.length != 0">
                <div
                  v-for="(item,index) in row.stockBoxInfo"
                  :key="index"
                >
                  {{$t('table.num/箱',{num: item.goodsNumInBox})}} × {{item.editNum}}
                </div>
              </template>


              <template v-else-if="row.middleBoxInfo.length != 0">
                <div
                  v-for="(item,index) in row.middleBoxInfo"
                  :key="index"
                >
                  {{$t('table.num/箱',{num: item.goodsNumInBox})}} × {{item.editNum}}
                </div>
              </template>
              <template v-else> - </template>
            </template>
          </el-table-column>
        <!--  <el-table-column
            :label="$t('table.预计从中转送仓调出')"
            align="center"
            width="150"
            prop="exMiddleStock"
          >
            <template v-slot="{row}">
              <template v-if="row.middleBoxInfo.length === 0"> - </template>
              <template v-else>
                <div
                  v-for="(item,index) in row.middleBoxInfo"
                  :key="index"
                >
                  {{$t('table.num/箱',{num: item.goodsNumInBox})}} × {{item.editNum}}
                </div>
              </template>
            </template>
          </el-table-column> -->

          <el-table-column
            :label="$t('table.预计贴标商品总数量')"
            width="200"
            prop="totalExGoodsNum"
            align="center"

          >
          </el-table-column>

          <el-table-column
            :label="$t('table.实际从一件代发贴标')"
            align="center"
            width="180"
            prop="rlOneStock"
          >
            <template v-slot="{row}" v-if="data.middle">
              <template v-if="data.status === 2">
                <span :class="[row.totalRlGoodsNum !== row.totalExGoodsNum ? 'font-red' : '']">{{row.totalRlGoodsNum}}</span>
              </template>
              <template v-else>
                <el-input-number
                  :step="1"
                  :precision="0"
                  :min="0"
                  v-model="row.rlMiddleStock"
                >
                 <!-- :disabled="row.fromGoodsIsSystem" -->
                </el-input-number>
              </template>
            </template>
            <template v-slot="{row}" v-else>

              <template v-if="data.status === 2">
               <span :class="[row.totalRlGoodsNum !== row.totalExGoodsNum ? 'font-red' : '']">{{row.totalRlGoodsNum}}</span>
              </template>
              <template v-else>
                <el-input-number
                  :step="1"
                  :precision="0"
                  :min="0"
                  v-model="row.rlOneStock"
                >
                 <!-- :disabled="row.fromGoodsIsTB" -->
                </el-input-number>
              </template>
            </template>
          </el-table-column>
         <!-- <el-table-column
            :label="$t('table.实际从中转库存贴标')"
            align="center"
            width="180"
            prop="rlMiddleStock"
          >
            <template v-slot="{row}">
              <template v-if="data.status === 2">
                <span :class="[row.rlMiddleStock !== row.exMiddleStock ? 'font-red' : '']">{{row.rlMiddleStock}}</span>
              </template>
              <template v-else>
                <el-input-number
                  :step="1"
                  :precision="0"
                  :min="0"
                  v-model="row.rlMiddleStock"
                  :disabled="row.fromGoodsIsSystem"
                >
                </el-input-number>
              </template>
            </template>
          </el-table-column> -->


         <!-- <template v-if="data.status === 2">
            <el-table-column
              :label="$t('table.实际贴标商品总数量')"
              width="200"
              prop="totalRlGoodsNum"
              align="center"
            >
              <template v-slot="{row}">
                <span :class="[row.totalRlGoodsNum !== row.totalExGoodsNum ? 'font-red' : '']">{{row.totalRlGoodsNum}}</span>
              </template>
            </el-table-column>
          </template> -->

          <el-table-column
            :label="$t('table.operate')"
            min-width="200"
            prop="operate"
          >
            <template slot-scope="{row}">
              <el-button type="primary" @click="showLabelPdf(row)">{{ $t('labelOrder.导出SKU标') }}</el-button>
              <el-button :type="row.save ? 'warning' : 'primary'" @click="saveBatchRlGoodsNum(row)" v-if="data.status === 1">
                {{ $t('common.save') }}</el-button>
            </template>
          </el-table-column>

        </el-table>
      </template>

      <template v-if="data.type === 3">
        <el-table
          :data="goodsData"
          :border="true"
          class="goods-table"
          :span-method="objectSpanMethod3"
        >
          <el-table-column
            prop="image"
            :label="$t('table.productCover')"
            align="center"
            width="120"
          >
            <template slot-scope="{row}">
              <div class="img-box img-one">
                <img :src="row.image" alt="">
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="title"
            :label="$t('table.title')"
            align="left"
            min-width="250"
          >
            <template slot-scope="{row}">
              <div>
                <div class="goods-title hidden-1" :title="row.title">{{row.title}}</div>
                <div class="goods-attr hidden-1">
                  <span
                    v-for="attr in row.attributes"
                    :key="attr.name"
                    class="attr"
                  >
                    {{attr.name}} : {{attr.value}}
                    <span class="attr-link"> | </span>
                  </span>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column
            :label="$t('table.本次贴标的Listing ID与SKU')"
            align="center"
            min-width="150"
            prop="toGoodsId"
          >
            <template v-slot="{row}">
              {{row.toGoodsId}} {{row.toSku ? `(${row.toSku})` : ''}}
            </template>
          </el-table-column>
          <m-l-code-column label="新产品标" prop="toInventoryId"></m-l-code-column>
          <el-table-column
            label="旧产品标"
            align="center"
            min-width="150"
          >
            <template slot-scope="{row}">
              <template v-if="row.fromGoodsIsTB">
                {{$t('shipment.Not labeled')}}
              </template>
              <template v-else>
                {{row.fromGoodsId}}{{row.fromSku ? `(${row.fromSku})` : ''}}
              </template>
            </template>
          </el-table-column>

          <!-- <m-l-code-column prop="fromInventoryId" :label="$t('table.调出MLCode')"></m-l-code-column> -->

          <el-table-column
            :label="$t('table.从中转送仓库存调出')"
            width="150"
            prop="exGoodsNum"
            align="center"
          >
            <template v-slot="{row}">
              <template v-if="row.middleBoxInfo.length === 0"> - </template>
              <template v-else>
                <div
                  v-for="(item,index) in row.middleBoxInfo"
                  :key="index"
                >
                  {{$t('table.num/箱',{num: item.goodsNumInBox})}} × {{item.editNum}}
                </div>
              </template>
            </template>
          </el-table-column>
          <el-table-column
            :label="$t('table.预计贴标商品总数量')"
            width="200"
            prop="totalExGoodsNum"
            align="center"
          >
            </el-table-column>
          <el-table-column
            :label="$t('table.实际贴标数量')"
            width="180"
            prop="rlMiddleStock"
            align="center"
          >
            <template slot-scope="{row}">
              <template v-if="data.status === 1">
                <el-input-number
                  :step="1"
                  :precision="0"
                  :min="0"
                  v-model="row.rlMiddleStock"
                >
                </el-input-number>
              </template>
              <template v-else>
                <span :class="{'font-red': row.rlGoodsNum !== row.exGoodsNum}">{{row.rlGoodsNum}}</span>
              </template>
            </template>
          </el-table-column>

       <!--  <el-table-column
            prop="inventoryLocation"
            align="center"
            :label="$t('table.inventoryLocation.存放库位')"
            min-width="160"
          >
            <template slot-scope="{row}">
              <template v-if="row.inventoryLocationStr === ''">
                -
              </template>
              <template v-else>
                {{row.inventoryLocationStr}}
              </template>
            </template>
          </el-table-column> -->

          <el-table-column
            :label="$t('table.operate')"
            min-width="200"
            prop="operate"
          >
            <template slot-scope="{row}">
              <el-button type="primary" @click="showLabelPdf(row)">导出产品标</el-button>
              <el-button type="primary" @click="saveRlGoodsNum(row)" v-if="data.status === 1">{{ $t('common.save') }}</el-button>
            </template>
          </el-table-column>

        </el-table>
      </template>
    </div>

    <div class="footer" v-if="data.status === 1">
      <div class="font-red">{{ $t('labelOrder.如若实际贴标数量与预计贴标数量有差异，请先与用户沟通确认') }}</div>
      <div class="font-grey">{{ $t('labelOrder.单独保存SKU后，当前工单仍会是待贴标工单，请通过底部「确认已贴标」按钮确认贴标完成') }}</div>
    </div>

    <div class="remark mgt20" v-if="data.remark">
      <h4>{{$t('shipment.step4Text10')}}：</h4>
      <el-input type="textarea" style="width: 1500px"  v-model="data.remark" autosize></el-input>
    </div>

    <div class="submit-box mgt20" v-if="canSubmit && data.type === 1">
      <el-button @click="jumpPage('labelOrderList')">{{ $t('common.back') }}</el-button>
      <template v-if="data.status === 1">
        <template v-if="containerId">
          <el-button type="primary" @click="labelPart" :loading="btnLoading">部分商品贴标</el-button>
        </template>
        <template v-else>
          <el-button type="primary" @click="checkGoodsNum" v-if="data.status === 1" :loading="btnLoading">{{$t('labelOrder.确认已贴标')}}</el-button>
        </template>
      </template>


    </div>

    <el-dialog
      title="请确认导出产品标数量"
      :visible.sync="labelPdfDialog"
      width="500px"
    >
      <div>
        <el-form
          ref="labelPdfForm"
          :model="labelPdfForm"
          label-width="150px"
        >
          <el-form-item
            label="产品标导出数量"
            prop="num"
          >
            <el-input-number
              :step="1"
              :precision="0"
              :min="1"
              v-model="labelPdfForm.num"
            >
            </el-input-number>
          </el-form-item>
        </el-form>
      </div>
      <div class="footer" slot="footer" style="margin-top: -20px">
        <el-button @click="labelPdfDialog = false">{{$t('common.cancel')}}</el-button>
        <el-button @click="exportLabelPdf" :loading="labelPdfLoading" type="primary">{{$t('common.confirm')}}</el-button>
      </div>

    </el-dialog>
  </div>
</template>

<script>
import {deepCopy} from "@/utils";
import {
  exportLabelGoodsLabelPdf,
  finishLabelOrder,
  labelPartGoods,
  saveBatchRlGoodsNum,
  saveRlGoodsNum
} from "@/api/labelOrder";
import {jumpMiddleInfo, jumpPage, jumpShipmentInfo, jumpTransferInfo} from "@/utils/jumpView";
import {getLabelStatusStr, getLabelTypeStr} from "@/utils/labelOrder";
import MLCodeColumn from "@/views/stock/components/MLCodeColumn.vue";
import LabelOrderInfoTable1 from "@/views/labelOrder/components/LabelOrderInfoTable1.vue";

export default {
  name: 'LabelOrderInfoView',
  components: {LabelOrderInfoTable1, MLCodeColumn},
  props: {
    data: {
      type: Object,
      required: true,
    },
    goodsData: {
      type: Array,
      required: true,
    },
    // 是否能提交表单
    canSubmit: {
      type: Boolean,
      default: false,
    },
    containerList: {
      type: Array,
    },
  },
  computed: {
    filterGoodsData(){
      if(this.containerId){
        return this.goodsData.filter(item => item.containerId === this.containerId)
      }else{
        return this.goodsData
      }
    }
  },
  data(){
    return {
      labelPdfForm: {},
      labelPdfDialog: false,
      labelPdfLoading: false,
      btnLoading: false,
      containerId: '', // 货柜的id
    }
  },
  methods:{
    jumpPage,
    getLabelStatusStr,
    getLabelTypeStr,
    jumpTransferInfo,
    jumpShipmentInfo,
    jumpMiddleInfo,
    // 导出sku标
    showLabelPdf(row){
      this.labelPdfForm.id = row.id
      this.labelPdfForm.num = row.exGoodsNum
      if(this.data.type === 1){
        this.labelPdfForm.num = row.exBoxNum * row.goodsNumInBox + row.exGoodsNum
      }
      this.labelPdfDialog = true
    },
    // 导出sku标
    exportLabelPdf(){
      this.labelPdfLoading = true
      const params = deepCopy(this.labelPdfForm)
      exportLabelGoodsLabelPdf(this.labelPdfForm)
        .then(res=>{
          this.labelPdfLoading = false
          this.labelPdfDialog = false
          const pdfFile = window.URL.createObjectURL(
            new Blob([res.data], { type: "application/pdf" })
          );
          if(this.data.status === 1){
            this.goodsData.some(item=>{
              if(item.id === params.id){
                item.rlOneStock = item.rlOneStock ? item.rlOneStock : 0
                item.rlBoxNum = item.rlBoxNum ? item.rlBoxNum : 0
                if(this.data.type === 1){
                  let goodsNumInBox = item.goodsNumInBox // 箱装数
                  let addBoxNum = 0; // 新增的箱数
                  let addGoodsNum = params.num; // 新增的混装数
                  if(goodsNumInBox > 0){
                    addBoxNum = Math.floor(params.num / goodsNumInBox)
                    addGoodsNum = params.num - addBoxNum * goodsNumInBox
                  }
                  for (let i = 1; i <= addBoxNum ; i++) {
                    if(item.rlBoxNum >= item.exBoxNum){
                      item.rlOneStock += goodsNumInBox
                    }else{
                      item.rlBoxNum++
                    }
                  }
                  item.rlOneStock += addGoodsNum
                }
                if(this.data.type === 2){
                  for (let i = 0; i < params.num; i++) {
                    if(item.exOneStock > item.rlOneStock){
                      item.rlOneStock++
                    }else{
                      if(item.fromGoodsIsSystem){
                        item.rlOneStock++
                      }else{
                        item.rlMiddleStock++
                      }
                    }
                  }
                }
                if(this.data.type === 3){
                  item.rlMiddleStock = item.rlMiddleStock ? item.rlMiddleStock : 0;
                  item.rlMiddleStock += params.num
                }
                return true
              }
            })
          }

          // 跳转页面预览
          window.open(pdfFile);
          // 60秒后释放
          setTimeout(()=>{
            URL.revokeObjectURL(pdfFile); //释放URL对象
          },60000)
        })
    },
    // 保存某条贴标数据
    saveRlGoodsNum(row){
      const data = {
        id: row.id,
        rlGoodsNum: row.rlOneStock + row.rlMiddleStock,
        rlOneStock: row.rlOneStock,
        rlMiddleStock: row.rlMiddleStock
      }
      saveRlGoodsNum(data)
        .then(res=>{
          // 成功不刷新数据
          if(res.error === 0){
            this.$successMessage(res.message)
          }else{
            this.$errorMessage(res.message)
          }
        })
    },
    // 批量保存
    saveBatchRlGoodsNum(row){
      const data = {
        data: [],
      }
      this.goodsData.forEach(item=>{
        if(item.toSuitListId === row.toSuitListId){
          item.rlOneStock = item.rlOneStock ? item.rlOneStock : 0;
          item.rlMiddleStock = item.rlMiddleStock ? item.rlMiddleStock : 0;
          data.data.push({
            id: item.id,
            rlGoodsNum: item.rlOneStock + item.rlMiddleStock,
            rlOneStock: item.rlOneStock,
            rlMiddleStock: item.rlMiddleStock
          })
          item.save = true
        }
      })
      saveBatchRlGoodsNum(data)
        .then(res=>{
          // 成功不刷新数据
          if(res.error === 0){
            this.$successMessage(res.message)
          }else{
            this.$errorMessage(res.message)
          }
        })
    },
    objectSpanMethod1({ row, column, rowIndex, columnIndex }) {
      const mergeCell = this.mergeCell1()
      if(mergeCell[column.property]){
        if(mergeCell[column.property][rowIndex]) {
          return [mergeCell[column.property][rowIndex], 1]
        } else {
          // 如果为0则为需要合并的行
          return [0, 0];
        }
      }
    },
    mergeCell1(){
      const mergeObj = {};
      // 根据suitId合并的字段
      const mergeFieldArr = [
        'image',
        'title',
        'totalExGoodsNum',
        'totalRlGoodsNum',
        'inventoryLocation',
      ];

      mergeFieldArr.forEach(key=>{
        mergeObj[key] = [1];
      })

      let mergeFieldKey = 0;
      this.goodsData.forEach((item,index)=>{
        // 第一列数据不处理
        if(index === 0){
          return;
        }
        // 根据suitId 合并
        if(item.fromSuitId && item.fromSuitId === this.goodsData[index - 1].fromSuitId){
          mergeFieldArr.forEach(key=>{
            mergeObj[key][mergeFieldKey] += 1;
            mergeObj[key].push(0); // 添加一个0 站位
          })
        }else{
          mergeFieldKey = index; // 记录当前行
          mergeFieldArr.forEach(key=>{
            mergeObj[key].push(1); // 添加一个1
          })
        }
      })

      return mergeObj;
    },
    objectSpanMethod3({ row, column, rowIndex, columnIndex }) {
      const mergeCell = this.mergeCell3()
      if(mergeCell[column.property]){
        if(mergeCell[column.property][rowIndex]) {
          return [mergeCell[column.property][rowIndex], 1]
        } else {
          // 如果为0则为需要合并的行
          return [0, 0];
        }
      }
    },
    mergeCell3(){
      const mergeObj = {};
      // 根据suitId合并的字段
      const mergeFieldArr = [
        'image',
        'title',
        'toGoodsId',
        'totalRlGoodsNum',
        'totalExGoodsNum',
        'toInventoryId',
      ];

      mergeFieldArr.forEach(key=>{
        mergeObj[key] = [1];
      })

      let mergeFieldKey = 0;
      this.goodsData.forEach((item,index)=>{
        // 第一列数据不处理
        if(index === 0){
          return;
        }
        // 根据suitId 合并
        if(item.toSuitListId && item.toSuitListId === this.goodsData[index - 1].toSuitListId){
          mergeFieldArr.forEach(key=>{
            mergeObj[key][mergeFieldKey] += 1;
            mergeObj[key].push(0); // 添加一个0 站位
          })
        }else{
          mergeFieldKey = index; // 记录当前行
          mergeFieldArr.forEach(key=>{
            mergeObj[key].push(1); // 添加一个1
          })
        }
      })

      return mergeObj;
    },
    calTotalExGoodsNum(row){
      return this.goodsData.filter(item=> item.toSuitId === row.toSuitId)
        .reduce((sum,item)=> sum + item.exGoodsNum + item.goodsNumInBox * item.exBoxNum, 0)
    },
    calTotalRlGoodsNum(row){
      return this.goodsData.filter(item=> item.toSuitId === row.toSuitId)
        .reduce((sum,item)=> sum + item.rlOneStock + item.goodsNumInBox * item.rlBoxNum, 0)
    },
    checkGoodsNum(){
      this.$emit('submitGoods')
    },
    // 部分贴标
    labelPart(){
      new Promise((resolve, reject)=>{
        resolve()
      })
        .then(()=>{
          return new Promise((resolve, reject)=>{
            let flag = false
            if(this.data.type !== 1){
              this.filterGoodsData.forEach(item=>{
                item.rlGoodsNum = item.rlOneStock + item.rlMiddleStock
              })
            }
            flag = this.filterGoodsData.some(item=>{
              return item.rlGoodsNum !== item.exGoodsNum
            })
            if(flag){
              this.$warning(this.$t('labelOrder.实际贴标数据与预计贴标数量有差异，请先与客户沟通确认'),{
                'title': this.$t('labelOrder.确认贴标？'),
              })
                .then(()=>{
                  resolve()
                })
                .catch(()=>{
                  reject()
                })
            }else{
              resolve()
            }
          })
        })
        .then(()=>{
          const data = {
            id: this.data.id,
            goodsData: this.filterGoodsData
          }
          this.btnLoading = true
          labelPartGoods(data)
            .then(res=>{
              this.btnLoading = false
              if(res.error === 0) {
                this.$emit('getData')
                this.$successMessage(res.message)
              } else {
                this.$errorMessage(res.message)
              }
            })
        })
        .catch(()=>{

        })
    }
  }
}
</script>


<style scoped lang="scss">
.wrap {
  padding: 30px 30px;
  .header{
    //display: flex;
    //justify-content: space-between;
  }
  .content{
    padding: 20px 0 0;
  }
  .header-card{
    font-size: 14px;
    background-color: rgba(242, 242, 242, 1);
    p{
      margin: 10px 0;
      padding: 0;
    }
    .font-bold{
      font-weight: bold;
    }
    .true-number{
      color: #FF0000;
      font-weight: 600;
    }
  }
}
.goods-table{
  .goods-title{
    font-size: 14px;
  }
  .goods-attr{
    font-size: 13px;
    color: #7F7F7F;
  }
}
.table-tips{

}

.header-card{
  position: relative;
  .button{
    position: absolute;
    display: flex;
    flex-direction: column;
    right: 20px;
    top: 30px;
  }
}
.footer{
  font-size: 13px;
  margin-top: 10px;
}
</style>
